import { FormProps, FormSchema } from '@/components/Table'
import api from '@/api'

// 权限信息表单
export function getAuthorityFormConfig(): Partial<FormProps> {
  return {
    layout: 'vertical',
    showActionButtonGroup: false,
    baseColProps: {
      span: 24,
      style: {
        marginBottom: '4px'
      }
    },
    schemas: [
      {
        field: 'authorityType',
        component: 'RadioGroup',
        label: '权限类型',
        defaultValue: 0,
        componentProps: {
          options: [
            {
              label: '菜单',
              value: 0
            },
            {
              label: '按钮',
              value: 1
            },
            {
              label: '应用',
              value: 2
            }
          ]
        }
      },
      {
        field: 'authorityName',
        component: 'Input',
        label: '权限名称',
        required: true
      },
      {
        field: 'parentAuthorityId',
        label: '父级权限名称',
        component: 'TreeSelect',
        slot: 'parentAuthorityId',
        defaultValue: '0',
        required: true
      },
      {
        field: 'functionUrl',
        component: 'Input',
        label: '权限路径'
      },
      {
        field: 'icon',
        component: 'Input',
        label: '图标名称'
      },
      {
        field: 'sort',
        component: 'InputNumber',
        defaultValue: 0,
        label: '排序',
        componentProps: {
          precision: 0
        }
      }
    ]
  }
}
